package com.kaifamiao.poly;

public class Student {

    private String name;
    private char gender;
    private int age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public char getGender() {
        return gender;
    }

    public void setGender(char gender) {
        if( gender == '男' || gender == '女' ) {
            this.gender = gender;
        }
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if( age >= 0 && age <= 200 ) {
            this.age = age;
        }
    }

    public void learn( String content ){
        System.out.println( name + "正在学习" + content );
    }

    @Override
    public String toString() {
        return String.format( "(%s, %c, %d)" , name, gender, age);
    }
}
